<?php  if (!defined('BASEPATH')) exit('No direct script access allowed');

/**
 *
 *
 *  生成邮件内容类
 * 智联专用
 *
 * 
 */

class Cemail{

	/**
	 * 邮件头构建(css/header)
	 * @return [type] [description]
	 */
	private function _header()
	{
		$email = '<base target="_blank" />';
		$email .= '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">';
		$email .= '<style type="text/css">::-webkit-scrollbar{display:none}body{font-size:14px;font-family:arial,verdana,sans-serif;line-height:1.666;padding:0;margin:0;overflow:auto;white-space:normal;word-wrap:break-word;min-height:100px}body,button,input,select,td{font-family:Helvetica,"Microsoft Yahei",verdana}pre{white-space:pre-wrap;white-space:-moz-pre-wrap;white-space:-pre-wrap;white-space:-o-pre-wrap;word-wrap:break-word;width:95%}td,th{font-family:arial,verdana,sans-serif;line-height:1.666}img{border:0}article,aside,figcaption,figure,footer,header,hgroup,nav,section{display:block}a,td a{color:#064977}#divNeteaseBigAttach,#divNeteaseBigAttach_bak{display:none}blockquote{display:none}.my-btn{display:inline-block;width:120px;height:40px;margin:40px auto;background-color:#00b38a;border-radius:3px;font-size:16px;line-height:40px;color:#fff;text-align:center;text-decoration:none}.list-group-item{position:relative;display:block;padding:10px 15px;margin-left:-38px;margin-bottom:-1px;background-color:#fff;border:1px solid #ddd}</style><table cellpadding="0" cellspacing="0" border="0" width="640" style="margin:0 auto;color:#555; font:16px/26px "微软雅黑","宋体",Arail; "><tbody><tr style="background-color:#fff;"><td style="padding:10px 38px;">';
		return $email;
	}

	/**
	 * 邮件正文，列表处理
	 * @param  [type] $list    [description]
	 * @param  [type] $message [description]
	 * @return [type]          [description]
	 */
	private function _body($list,$message)
	{
		$html = '<div style="width:100%;" class="my-btn"><img style="float:left;" src="http://security.zhaopin.me/zhilianyun_security/img/extmail_logo.gif"><b style="float:left;">智联安全运维平台</b></div>';
		$html .= '<div style="margin:20px 0;font-size: 14px;">'.$message.'<hr />';
		$html .= '<pre>';
		if (is_array($list)){
			foreach($list as $key => $value){
					$html .='<p align="left"><span style="font-weight:700;">'. $key .'</span></p><p align="left">&nbsp;&nbsp;'.$value.'</p>';
			}
		}
		$html .='</pre>';
		return $html;
	}

	/**
	 * 构建页面处理通告信息
	 * 主要用于智联安全运维平台的信息发送(友好提醒)
	 * @param  [type] $body_arr1 [内容项的主体数组]
	 * @param  [type] $body_arr2 [自定义内容信息]
	 * @param  [type] $button    [按钮]
	 * @return [type]            [description]
	 */
	public function message_html($body_arr1,$body_arr2)
	{
		$email = '<base target="_blank" />';
		$email .= '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">';
		$email .= '<style type="text/css">::-webkit-scrollbar{display:none}body{font-size:14px;font-family:arial,verdana,sans-serif;line-height:1.666;padding:0;margin:0;overflow:auto;white-space:normal;word-wrap:break-word;min-height:100px}body,button,input,select,td{font-family:Helvetica,"Microsoft Yahei",verdana}pre{white-space:pre-wrap;white-space:-moz-pre-wrap;white-space:-pre-wrap;white-space:-o-pre-wrap;word-wrap:break-word;width:95%}td,th{font-family:arial,verdana,sans-serif;line-height:1.666}img{border:0}article,aside,figcaption,figure,footer,header,hgroup,nav,section{display:block}a,td a{color:#064977}#divNeteaseBigAttach,#divNeteaseBigAttach_bak{display:none}blockquote{display:none}.my-btn{display:inline-block;width:120px;height:40px;margin:40px auto;background-color:#00b38a;border-radius:3px;font-size:16px;line-height:40px;color:#fff;text-align:center;text-decoration:none}</style><table cellpadding="0" cellspacing="0" border="0" width="640" style="margin:0 auto;color:#555; font:16px/26px "微软雅黑","宋体",Arail; "><tbody><tr><td style="height:62px; background-color:#019875; padding:10px 0 0 10px;"> <a href="http://www.lagou.com/" target="_blank"><img src="http://www.lagou.com/images/logo_email.png" width="229" height="43" alt="智联招聘" style="border:none;margin-left:10px;"></a> </td></tr><tr style="background-color:#fff;"><td style="padding:10px 38px;">';
		$email .='<div style="margin:20px 0;">'.implode('<br />',$body_arr1).'';
		$email .='<div style="height:10px; border-bottom:1px solid #e6e6e6; margin-top:10px; margin-bottom:10px;"></div>';
		$email .= $body_arr2.'<br><div style="text-align: center;"></div><!--<div style="height:190px;margin:20px auto 20px auto;width:550px;"><img src="http://www.lagou.com/images/email_app_no_bg.png" alt="扫描左边二维码" height="190" width="550"></div>--><div style="background:#fafafa;"><h2 style="font-size:14px;font-weight:300;margin:0 0 5px 0;">本邮件由智联安全运维平台发出，感谢使用。</h2></div><div style="font-size:12px; color:#999;line-height:20px;border-top:1px solid #e6e6e6;padding:10px 0;">如有任何问题，可以与我们联系，我们将尽快为你解答。<br> Email：<A href="mailto:src@zhaopin.com.cn">src@zhaopin.com.cn</A></div></div></td></tr></tbody></table>';
		return $email;
	}

	/**
	 * 创建html信息
	 * @param  [type] $list    [description]
	 * @param  [type] $message [description]
	 * @return [type]          [description]
	 */
	function createHtml($list,$message,$button)
	{
		$html = $this->_header();
		$html .= $this->_body($list,$message);
		$html .= '<center>'.$button.'</center>';
		return $html;
	}
}
/* End of file Someclass.php */